package com.yuexunit.finance.member.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

import com.yuexunit.finance.member.entity.FinanceEnterpriseContactEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.page.PageCriteria;
import com.yuexunit.page.PageList;
import com.yuexunit.persist.PersistUtil;
import com.yuexunit.persist.annotation.Transactional;

/**
*@version 创建时间：2016年8月30日 下午3:48:00
*@author wenwenlong
*类说明
*/

@Implements(FinanceEnterpriseContactService.class)
public class FinanceEnterpriseContactServiceImpl implements FinanceEnterpriseContactService {

	@Override
	@Transactional
	public Long createEnterpriseContact(FinanceEnterpriseContactEntity entity) {
		PersistUtil.insert(entity);
		return entity.getEnterpriseId();
	}

	@Override
	@Transactional
	public void updateEnterpriseContact(FinanceEnterpriseContactEntity entity) {
		PersistUtil.update(entity);
	}

	@Override
	@Transactional
	public void deleteEnterpriseContact(Long contactId) {
		PersistUtil.delete(FinanceEnterpriseContactEntity.class, contactId);
	}

	@Override
	public FinanceEnterpriseContactEntity inquireEnterpriseContactDetail(Long contactId) {
		return PersistUtil.get(FinanceEnterpriseContactEntity.class, contactId);
	}

	@Override
	public PageList<FinanceEnterpriseContactEntity> inquireEnterpriseContactPageList(PageCriteria page) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceEnterpriseContactEntity.class);
		return PersistUtil.get(criteria, page);
	}

	@Override
	public List<FinanceEnterpriseContactEntity> inquireEnterpriseContactList() {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceEnterpriseContactEntity.class);
		return PersistUtil.get(criteria);
	}
}
